<?php
namespace app\shop\controller;
use app\AdminRest;
use app\shop\model\Article;
use app\shop\model\Banner;
use app\shop\model\Date;
use app\shop\model\FreightConfig;
use app\shop\model\FreightProvince;
use app\shop\model\FreightTemplate;
use app\shop\model\Goods;
use app\shop\model\Integral;
use app\shop\model\Member;
use app\shop\model\OrderGoods;
use app\shop\model\RefundOrder;
use app\shop\model\Wallet;
use think\App;
use app\shop\model\User as Model;


class AdminMember extends AdminRest
{


    protected $model;

    protected $config_model;

    protected $province_model;

    public function __construct(App $app) {

        parent::__construct($app);

        $this->model = new Member();

        $this->config_model = new FreightConfig();

        $this->province_model = new FreightProvince();

    }


    /**
     * @author chenniang
     * @DataTime: 2021-10-29 13:43
     * @功能说明:会员列表
     */
    public function memberList(){

        $input = $this->_param;

        $dis[] = ['uniacid','=',$this->_uniacid];

        if(isset($input['status'])){

            $dis[] = ['status','=',$input['status']];
        }else{

            $dis[] = ['status','>',-1];
        }

        if(!empty($input['title'])){

            $dis[] = ['title','like','%'.$input['title'].'%'];
        }

        $data = $this->model->dataList($dis,$input['limit']);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-10-29 13:43
     * @功能说明:会员列表
     */
    public function memberSelect(){

        $input = $this->_param;

        $dis[] = ['uniacid','=',$this->_uniacid];

        $dis[] = ['status','=',1];

        if(!empty($input['title'])){

            $dis[] = ['title','like','%'.$input['title'].'%'];
        }

        $data = $this->model->where($dis)->order('id desc')->select()->toArray();

        return $this->success($data);

    }

    /**
     * @author chenniang
     * @DataTime: 2022-07-11 15:47
     * @功能说明:添加会员
     */
    public function memberAdd(){

        $input = $this->_input;

        $input['uniacid'] = $this->_uniacid;

        $res = $this->model->dataAdd($input);

        return $this->success($res);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-07-11 16:44
     * @功能说明:编辑会员
     */
    public function memberUpdate(){

        $input = $this->_input;

        $dis = [

            'id' => $input['id']
        ];

        $input['uniacid'] = $this->_uniacid;

        $res = $this->model->dataUpdate($dis,$input);

        return $this->success($res);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-07-11 16:45
     * @功能说明:会员详情
     */
    public function memberInfo(){

        $input = $this->_param;

        $dis = [

            'id' => $input['id']
        ];

        $input['uniacid'] = $this->_uniacid;

        $res = $this->model->dataInfo($dis);

        return $this->success($res);

    }














}
